package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import light.head.constant.Sys;

import org.hibernate.annotations.Formula;

/**
 * 公告表
 */
@Entity
@Table
public class Announcement implements Serializable{

	private static final long serialVersionUID = -4182779665737362840L;
	
	private Integer code;
	private String title;			//标题
	private String content;			//内容
	private Integer oc;				//机构
	private Date ct;				//创建时间
	private Boolean deleted;		//是否删除
	private Date rt;				//发布时间
	private Byte status = Sys.B_ONE;			//审核状态(1.未审核2.通过3.不通过)
	private Integer uc;				//审核人
	private Date time;				//审核时间
	private Boolean draft;			//是否草稿
	private Integer cu;				//创建者
	private String remark;
	
	//Formula
	private String un;				//审核人
	private String cuname;
	private String on;
	private List<AnnCollect> collcetList;
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public String getTitle() {
		return title;
	}
	@Column(length = 10000)
	public String getContent() {
		return content;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Date getRt() {
		return rt;
	}
	@Column
	public Byte getStatus() {
		return status;
	}
	@Column
	public Boolean getDraft() {
		return draft;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCuname() {
		return cuname;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Transient
	public List<AnnCollect> getCollcetList() {
		return collcetList;
	}
	@Column
	public Integer getUc() {
		return uc;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column
	public Date getTime() {
		return time;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = uc)")
	public String getUn() {
		return un;
	}
	@Column
	public String getRemark() {
		return remark;
	}
	
	
	
	
	
	

	
	
	public void setOn(String on) {
		this.on = on;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public void setUc(Integer uc) {
		this.uc = uc;
	}
	public void setTime(Date time) {
		this.time = time;
	}
	public void setUn(String un) {
		this.un = un;
	}
	public void setCollcetList(List<AnnCollect> collcetList) {
		this.collcetList = collcetList;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setCuname(String cuname) {
		this.cuname = cuname;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}

	public void setCode(Integer code) {
		this.code = code;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setRt(Date rt) {
		this.rt = rt;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}
	public void setDraft(Boolean draft) {
		this.draft = draft;
	}
	
	
	
	

}
